<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Eingebettete Frames definieren</title>
</head>
<body>

<h1>Fenstergucker</h1>
<?php
Yii::import('application.models.invoice');
Yii::import('application.vendors.fpdf.*');
require('fpdf.php');

$varNames = array(
    'noheaders',
    'marginLeft',
    'headerUseFill',
    'headerInfosX',
    'headerInfosY',
    'headerDrawBorders',
    'vehicleInfosX',
    'vehicleUseFill',
    'vehicleDrawBorders',
    'itemsTableSize',
    'itemsTableUseFill',
    'itemsTableUseColors',
    'itemsTableDrawBorders',
);

$vars = new StdClass;
$pdf = new InvoicePDF();
$objectVars = $pdf->getVars();
foreach($varNames as $variable) {
    if(isset($objectVars[$variable]))
        $vars->$variable = $objectVars[$variable];
}
if(isset($_POST['invoice'])) {
    foreach($varNames as $variable) {
        if(isset($_POST['invoice'][$variable]))
            $vars->$variable = $_POST['invoice'][$variable];
    }
}
$params = array();
foreach($varNames as $variable) {
    if($variable=='noheaders') continue;
    $params[] = 'invoice['.$variable.']='.$vars->$variable;
}
$params = join('&',$params);
if($vars->noheaders)
    $params .= '&noheaders=1';
?>
<form method="post">
<table width="95%" align="center">
    <tr>
        <td width="75%">
            <iframe src="index.php?r=invoice/printPDF&id=<?php echo $_GET['id'].'&'.$params ?>" width="90%" height="600" name="SELFHTML_in_a_box">
              <p>Ihr Browser kann leider keine eingebetteten Frames anzeigen:
              Sie k&ouml;nnen die eingebettete Seite &uuml;ber den folgenden Verweis
              aufrufen: <a href="../../../index.htm">SELFHTML</a></p>
            </iframe>
        </td>
        <td valign="top">
            <!-- <div style="height:75px;overflow:auto"><?php // echo str_replace('&','<br/>',$params); ?></div> -->
            <fieldset>
                <legend>Header</legend>        
                Rand links:&nbsp;
                <input type="text" name="invoice[marginLeft]" value="<?php echo $vars->marginLeft ?>" size="5" style="text-align:center"/><br/>

                Hide Header, Address:&nbsp;
                <input type="checkbox" name="invoice[noheaders]" value="1" <?php echo $vars->noheaders ? 'checked="checked" ' : ''; ?> /><br/>
            </fieldset>
            <fieldset>
            <legend>Invoice Infos</legend>
                Pos. X:&nbsp;
                <input type="text" name="invoice[headerInfosX]" value="<?php echo $vars->headerInfosX ?>" size="5" style="text-align:center"/><br/>

                Pos. Y:&nbsp;
                <input type="text" name="invoice[headerInfosY]" value="<?php echo $vars->headerInfosY ?>" size="5" style="text-align:center"/><br/>

                Use Filling:&nbsp;
                <input type="checkbox" name="invoice[headerUseFill]" value="1" <?php echo $vars->headerUseFill ? 'checked="checked" ' : ''; ?> /><br/>
                Draw Borders:&nbsp;
                <input type="checkbox" name="invoice[headerDrawBorders]" value="1" <?php echo $vars->headerDrawBorders ? 'checked="checked" ' : ''; ?> /><br/>
            </fieldset>
            <fieldset>
                <legend>Vehicle Infos</legend>
                    Pos. X:&nbsp;
                    <input type="text" name="invoice[vehicleInfosX]" value="<?php echo $vars->vehicleInfosX ?>" size="5" style="text-align:center"/><br/>

                    Use Filling:&nbsp;
                    <input type="checkbox" name="invoice[vehicleUseFill]" value="1" <?php echo $vars->vehicleUseFill ? 'checked="checked" ' : ''; ?> /><br/>
                    Draw Borders:&nbsp;
                    <input type="checkbox" name="invoice[vehicleDrawBorders]" value="1" <?php echo $vars->vehicleDrawBorders ? 'checked="checked" ' : ''; ?> /><br/>
            </fieldset>
            <fieldset>
                <legend>Items Table</legend>
                Use Filling:&nbsp;
                <input type="checkbox" name="invoice[itemsTableUseFill]" value="1" <?php echo $vars->itemsTableUseFill ? 'checked="checked" ' : ''; ?> /><br/>

                Use Color:&nbsp;
                <input type="checkbox" name="invoice[itemsTableUseColors]" value="1" <?php echo $vars->itemsTableUseColors ? 'checked="checked" ' : ''; ?> /><br/>
                
                Draw Borders:&nbsp;
                <input type="checkbox" name="invoice[itemsTableDrawBorders]" value="1" <?php echo $vars->itemsTableDrawBorders ? 'checked="checked" ' : ''; ?> /><br/>
            </fieldset><br/>
            <input type="submit" name="Refresh" value="Refresh" onclick="">
        </td>
    </tr>
</table>
</form>

</body>
</html>
